﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

using Cisoft.Cisoft3G.Model;
using Cisoft.Cisoft3G.BLL;

public partial class UserControl_Default : System.Web.UI.Page
{
    private string _strc = string.Empty;
    public string strC
    {
        get { return this._strc; }
        set { this._strc = value; }
    }

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            BindTree(0, (TreeNode)null);
        }
        Response.Write(Request.ApplicationPath);
    }

    #region 绑定TreeView数据
    //绑定TreeView数据
    private void BindTree(int pid, TreeNode node)
    {
        List<ContactGroupMO> modelList = new ContactGroupBO().GetModelList(" CG_ParentID = " + pid + " order by CG_Order desc");
        foreach (ContactGroupMO model in modelList)
        {
            TreeNode tn = new TreeNode();
            if (node == null)
            {
                tn = new TreeNode();
                tn.Text = "<a style='text-decoration:none;' href='GetContactsHandler.ashx?ContactGroupID=" + model.CG_ContactGroupID + "'>" + model.CG_GroupName + "</a>";
                tn.NavigateUrl = "javascript:void(0);";
                tvContactsGroup.Nodes.Add(tn);
                BindTree(model.CG_ContactGroupID, tn);
            }
            else
            {
                tn = new TreeNode();
                tn.Text = "<a style='text-decoration:none;' href='GetContactsHandler.ashx?ContactGroupID=" + model.CG_ContactGroupID + "'>" + model.CG_GroupName + "</a>";
                tn.NavigateUrl = "javascript:void(0);";
                node.ChildNodes.Add(tn);
                BindTree(model.CG_ContactGroupID, tn);
            }
        }
    }
    #endregion

}
